#include <cstdio>
#include <cstring>

int book[65];

int main() {
	while (true) {
		int n;
		scanf("%d", &n);
		if (!n) break;
		memset(book, 0, sizeof(book));
		book[1] = 1;
		book[2] = 2;
		book[3] = 3;
		book[4] = 4;
		for (int i=5; i<=n; i++) {
			book[i] = book[i-1]+book[i-3];
		}
		printf("%d\n", book[n]);
	}
	
	
	return 0;
}
